import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

let routes = [
    {
        path: '/',
        redirect: '/login'
    },

    {
        path: '/login',
        name: 'Login',
        component: () => import("../views/Login")
    },
    {
        path: '/main',
        name: 'Main',
        component: () => import("../views/Main"),
        redirect: '/welcome',
        children: [
            {
                //欢迎页
                path: '/welcome',
                name: 'WelCome',
                component: () => import("../views/WelCome")
            },
            {
                //会员列表
                path: '/user/list',
                name: 'UserList',
                component: () => import("../views/user/UserList")
            },
            {
                //会员等级
                path: '/user/level/:id',
                name: 'UserLevel',
                component: () => import("../views/user/UserLevel")
            },
            {
                //商品分类
                path: '/good/category',
                name: 'GoodCategory',
                component: () => import("../views/good/GoodCategory")
            },
            {
                //商品分类
                path: '/good/list',
                name: 'GoodList',
                component: () => import("../views/good/GoodList")
            },
            {
                //通知公告列表
                path: '/system/noticeList',
                name: 'NoticeList',
                component: () => import("../views/system/NoticeList")
            },
            {
                //通知公告添加
                path: '/system/noticeAdd',
                name: 'NoticeAdd',
                component: () => import("../views/system/NoticeAdd")
            },
            {
                //登录日志
                path: '/system/loginLog',
                name: 'LoginLog',
                component: () => import("../views/system/LoginLog")
            },
            {
                //聊天界面
                path: '/chat/chatView',
                name: 'ChatView',
                component: () => import("../views/chat/ChatView")
            },
            {
                //系统设置
                path: '/system/set',
                name: 'SystemSet',
                component: () => import("../views/system/SystemSet")
            },
            {
                //验证密码
                path: '/PassValidation',
                name: 'PassValidation',
                component: () => import("../views/PassValidation")
            },
            {
                //试题管理
                path: '/question/manage',
                name: 'QuestionManagement',
                component: () => import("../views/exam/QuestionManagement")
            },
            {
                //试卷总览
                path: '/question/AllPaper',
                name: 'AllPaper',
                component: () => import("../views/exam/AllPaper")
            },
            {
                //创建试卷
                path: '/question/createPaper',
                name: 'CreatePaper',
                component: () => import("../views/exam/CreatePaper")
            },
            {
                //创建试卷
                path: '/question/paperList',
                name: 'PaperList',
                component: () => import("../views/exam/PaperList")
            },
            {
                //考试页面
                path: '/question/test',
                name: 'TestPaper',
                component: () => import("../views/exam/TestPaper")
            },
            {
                //学生答题页面
                path: '/paper/userlist',
                name: 'AnswerUserList',
                component: () => import("../views/exam/AnswerUserList")
            },
            {
                //学生答题详细页面
                path: '/paper/detail',
                name: 'PaperDetail',
                component: () => import("../views/exam/PaperDetail")
            },
            {
                //学生个人考试信息列表
                path: '/paper/userTestList',
                name: 'UserInfoTest',
                component: () => import("../views/exam/UserInfoTest")
            },
            {
                //学生个人考试信息详情
                path: '/paper/userInfoPaperDetail',
                name: 'UserInfoPaperDetail',
                component: () => import("../views/exam/UserInfoPaperDetail")
            },
            {
                //excel导入和导出
                path: '/excel',
                name: 'Excel',
                component: () => import("../views/Excel")
            },
            {
                //excel导入
                path: '/upload',
                name: 'Upload',
                component: () => import("../views/Upload")
            },
        ]
    }
]

const createRouter = () => new VueRouter({
    mode: 'history',
    routes: routes
})

const router = createRouter()

export default router
